/* -------------------------------------------------------------------------- *
   TestWinUnit - Maria Blees (maria.blees@microsoft.com)

   File: DllMain.cpp
 * -------------------------------------------------------------------------- */
#include <windows.h>

// I'm including this function here to get the HMODULE of this DLL so I can 
// use it in a unit test (for import hooking).

HMODULE g_hmodule = 0;

BOOL WINAPI DllMain(
    HINSTANCE hinstDLL,  // handle to DLL module
    DWORD fdwReason,     // reason for calling function
    LPVOID /* lpReserved */)  // reserved
{
    // Perform actions based on the reason for calling.
    switch( fdwReason ) 
    { 
        case DLL_PROCESS_ATTACH:
         // Initialize once for each new process.
         // Return FALSE to fail DLL load.
            g_hmodule = (HMODULE)hinstDLL;
            break;

        case DLL_THREAD_ATTACH:
         // Do thread-specific initialization.
            break;

        case DLL_THREAD_DETACH:
         // Do thread-specific cleanup.
            break;

        case DLL_PROCESS_DETACH:
         // Perform any necessary cleanup.
            g_hmodule = 0;
            break;
    }
    return TRUE;  // Successful DLL_PROCESS_ATTACH.
}
